package com.eorchis.module.trainingquestionnaire.ui.commond;

import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jackson.map.ObjectMapper;

import com.eorchis.core.page.commond.SortInfoBean;
import com.eorchis.core.ui.commond.impl.BasePageQueryCommond;
import com.eorchis.core.ui.commond.IQueryCommond;

/**
 * Title: QuestionnaireCommond<br>
 * Description: 调查问卷Commond<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author Administrator
 * @createDate 2014-08-27
 * @version $Revision$
 */
public class QuestionnaireQueryCommond 
			extends BasePageQueryCommond implements IQueryCommond
{
	/**
	 * 活动状态：启用
	 */
	public static final Integer IS_ENABLE=new Integer(1);
	/**
	 * 发布状态：发布
	 */
	public static final Integer IS_PUBLISH=new Integer(1);
	
	/**
	 *列表类型：已选
	 */
	public static final String SELECTED="selected";
	/**
	 *列表类型：未选
	 */
	public static final String NONSSELECTED= "Nonselected";
	
	/**
	 * 活动状态：作废
	 */
	public static final Integer IS_CANCEL=new Integer(2);
	private String[] searchQuestionnaireIds;	
	/**
	 * 查询条件：ID
	 */
	public 	String searchType;//列表类型  :已选     未选
	public  String searchClassId;//班级ID
	private String searchQuestionnaireId;
	private Integer publishState;//发布状态(1:已发布 2:未发布)
	private Integer activeState;//活动状态
	private String searchQuestionnaireName;//问卷名称
	private String searchQuestionnaireType;//问卷类型
	private String searchUserName;//创建人
	private Date searchStartTime;//开始时间
	private Date searchEndTime;//结束时间
	private String searchCreateUnit;//创建单位
	private Integer searchPublishState;//发布时间
	private String searchUserId;//用户id
	private Date searchCreateDate;//创建时间
	private String courseIds;//课程IDs
	private String []searchClassIds;//班级id们
	private String searchUserLoginId;//登录号
	private String surveyObjectId;//配置对象ID
	private Integer assessmentState;//课程评估状态	1：未开始 2：正在评估 3：已评估 4：已过期
	private String method;//问卷请求方式		scan:班级问卷		con:课程问卷
	
	public String getSearchClassId() {
		return searchClassId;
	}
	public void setSearchClassId(String searchClassId) {
		this.searchClassId = searchClassId;
	}
	public String getSearchType() {
		return searchType;
	}
	public void setSearchType(String searchType) {
		this.searchType = searchType;
	}
	
	
	public String getSearchQuestionnaireName() {
		return searchQuestionnaireName;
	}
	public void setSearchQuestionnaireName(String searchQuestionnaireName) {
		this.searchQuestionnaireName = searchQuestionnaireName;
	}
	public String getSearchQuestionnaireType() {
		return searchQuestionnaireType;
	}
	public void setSearchQuestionnaireType(String searchQuestionnaireType) {
		this.searchQuestionnaireType = searchQuestionnaireType;
	}
	public String getSearchUserName() {
		return searchUserName;
	}
	public void setSearchUserName(String searchUserName) {
		this.searchUserName = searchUserName;
	}
	public Date getSearchStartTime() {
		return searchStartTime;
	}
	public void setSearchStartTime(Date searchStartTime) {
		this.searchStartTime = searchStartTime;
	}
	public Date getSearchEndTime() {
		return searchEndTime;
	}
	public void setSearchEndTime(Date searchEndTime) {
		this.searchEndTime = searchEndTime;
	}
	public String getSearchCreateUnit() {
		return searchCreateUnit;
	}
	public void setSearchCreateUnit(String searchCreateUnit) {
		this.searchCreateUnit = searchCreateUnit;
	}
	public Integer getSearchPublishState() {
		return searchPublishState;
	}
	public void setSearchPublishState(Integer searchPublishState) {
		this.searchPublishState = searchPublishState;
	}
	public Integer getPublishState() {
		return publishState;
	}
	public void setPublishState(Integer publishState) {
		this.publishState = publishState;
	}
	public Integer getActiveState() {
		return activeState;
	}
	public void setActiveState(Integer activeState) {
		this.activeState = activeState;
	}
	public String[] getSearchQuestionnaireIds() {
		return searchQuestionnaireIds;
	}
	public void setSearchQuestionnaireIds(String[] searchQuestionnaireIds) {
		this.searchQuestionnaireIds = searchQuestionnaireIds;
	}

	public String getSearchQuestionnaireId() {
		return searchQuestionnaireId;
	}
	public void setSearchQuestionnaireId(String searchQuestionnaireId) {
		this.searchQuestionnaireId = searchQuestionnaireId;
	}
	public String getSearchUserId()
	{
		return searchUserId;
	}
	public void setSearchUserId(String searchUserId)
	{
		this.searchUserId = searchUserId;
	}
	public Date getSearchCreateDate() {
		return searchCreateDate;
	}
	public void setSearchCreateDate(Date searchCreateDate) {
		this.searchCreateDate = searchCreateDate;
	}

	/**
	 * EXT 页面排序
	 */
	private SortInfoBean sortInfo = null;
	
	/**
	 * 获取排序内容
	 * 
	 * @return
	 * @author HuangS
	 * @date Jul 20, 2012
	 */
	public SortInfoBean getSortInfos() {
		return this.sortInfo;
	}

	/**
	 * 设置排序内容
	 * 
	 * @param sort
	 * @author HuangS
	 * @date Jul 25, 2012
	 */
	@SuppressWarnings("unchecked")
	public void setSort(String sort) {
		if (sort != null && !"".equals(sort)) {
			sortInfo = new SortInfoBean();
			ObjectMapper objectMapper = new ObjectMapper();
			try {
				List<LinkedHashMap<String, Object>> list = objectMapper.readValue(sort, List.class);
				for (int i = 0; i < list.size(); i++) {
					Map<String, Object> map = list.get(i);
					Set<String> set = map.keySet();
					for (Iterator<String> it = set.iterator(); it.hasNext();) {
						String key = it.next();
						BeanUtils.setProperty(sortInfo, key, map.get(key));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	public String getCourseIds() {
		return courseIds;
	}
	public void setCourseIds(String courseIds) {
		this.courseIds = courseIds;
	}
	public String getSurveyObjectId() {
		return surveyObjectId;
	}
	public void setSurveyObjectId(String surveyObjectId) {
		this.surveyObjectId = surveyObjectId;
	}
	public Integer getAssessmentState() {
		return assessmentState;
	}
	public void setAssessmentState(Integer assessmentState) {
		this.assessmentState = assessmentState;
	}
	public String [] getSearchClassIds() {
		return searchClassIds;
	}
	public void setSearchClassIds(String [] searchClassIds) {
		this.searchClassIds = searchClassIds;
	}
	public String getSearchUserLoginId() {
		return searchUserLoginId;
	}
	public void setSearchUserLoginId(String searchUserLoginId) {
		this.searchUserLoginId = searchUserLoginId;
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}

}
